*********************************************************************************************
*																							*		
*																							*		
*									Replication Do File for									*						
*					"Can't Live with Them or Can't Live Without Them? 						*					
*		How Varying Roles of Women in Rebel Groups Influence One-sided Violence"			*				
*                       		                   											*
*																							*
*********************************************************************************************;

clear


use "FF_NC_OSV.dta.dta"


*******************************Table 1 Descriptive Statistics*************************************

sum Fatalities frontline_fighters noncombat_outreach Bin_CentCom lpopl ln_duration dem_pol ln_BattFat ln_GovOSV lag1 leftist fertility Res_Exploit RebelStrength Secc_Con





******************************************************Table 2 Results**********************************************************

*******Model 1*******

nbreg Fatalities frontline_fighters noncombat_outreach, cluster (RebelID)


******Model 2******
nbreg Fatalities frontline_fighters noncombat_outreach Bin_CentCom lpopl dem_pol leftist fertility Res_Exploit Secc_Con, cluster (RebelID)


******Model 3******

nbreg Fatalities frontline_fighters noncombat_outreach Bin_CentCom lpopl ln_duration dem_pol ln_BattFat ln_GovOSV lag1 leftist fertility Res_Exploit RebelStrength Secc_Con, cluster (RebelID)


******Model 4******

nbreg Fatalities i.frontline_fighters noncombat_outreach Bin_CentCom lpopl ln_duration dem_pol ln_BattFat ln_GovOSV lag1 leftist fertility Res_Exploit RebelStrength Secc_Con, cluster (RebelID)







******************************************************Substantive Effects**********************************************************


**************Figure 1 using Model 3 Results***************


nbreg Fatalities frontline_fighters noncombat_outreach Bin_CentCom lpopl ln_duration dem_pol ln_BattFat ln_GovOSV lag1 leftist fertility Res_Exploit RebelStrength Secc_Con, cluster (RebelID)

margins, at(frontline_fighters=(0(1)3) (mean)_all)

marginsplot, recast(scatter)

save "FF.gph"


nbreg Fatalities frontline_fighters noncombat_outreach Bin_CentCom lpopl ln_duration dem_pol ln_BattFat ln_GovOSV lag1 leftist fertility Res_Exploit RebelStrength Secc_Con, cluster (RebelID)

margins, at(noncombat_outreach=(0 1) (mean)_all) 

marginsplot, recast(scatter)

save "NonCombat.gph"


graph combine FF.gph NonCombat.gph







***************Table 3: Predicted Counts of OSV at each level of Frontline Fighters and Noncombat Outreach**************

nbreg Fatalities frontline_fighters noncombat_outreach Bin_CentCom lpopl ln_duration dem_pol ln_BattFat ln_GovOSV lag1 leftist fertility Res_Exploit RebelStrength Secc_Con, cluster (RebelID)


margins, at(frontline_fighters=(0(1)3) noncombat_outreach=(0 1) (mean)_all)









***********************************************************Robustness Tests in Appendix***************************************************************


**************Cross-Tabulation of Frontline Fighters and Noncombat Outreach used in analysis in Table A1***************

nbreg Fatalities frontline_fighters noncombat_outreach Bin_CentCom lpopl ln_duration dem_pol ln_BattFat ln_GovOSV lag1 leftist fertility Res_Exploit RebelStrength Secc_Con, cluster (RebelID) 

tab frontline_fighters noncombat_outreach if e(sample)


*********Predicted Counts of OSV at each level of Frontline Fighters and Noncombat Outreach in Table A2**********


nbreg Fatalities i.frontline_fighters noncombat_outreach Bin_CentCom lpopl ln_duration dem_pol ln_BattFat ln_GovOSV lag1 leftist fertility Res_Exploit RebelStrength Secc_Con, cluster (RebelID) 

margins, at(frontline_fighters=(0(1)3) noncombat_outreach=(0 1) (mean)_all) 


**************Model 4 in appendices in Figure A1***************


nbreg Fatalities i.frontline_fighters noncombat_outreach Bin_CentCom lpopl ln_duration dem_pol ln_BattFat ln_GovOSV lag1 leftist fertility Res_Exploit RebelStrength Secc_Con, cluster (RebelID)

margins, at(frontline_fighters=(0(1)3) (mean)_all) 

marginsplot, recast(scatter) 

save "M4_FF.gph"


nbreg Fatalities i.frontline_fighters noncombat_outreach Bin_CentCom lpopl ln_duration dem_pol ln_BattFat ln_GovOSV lag1 leftist fertility Res_Exploit RebelStrength Secc_Con, cluster (RebelID) 

margins, at(noncombat_outreach=(0 1) (mean)_all) 

marginsplot, recast(scatter) 

save "M4_NonCombat.gph"


graph combine M4_FF.gph M4_NonCombat.gph



**************Using full measure of Frontline Fighters in Table A3**************

**Model 1 using both 

nbreg Fatalities frontline_prev_best noncombat_outreach Bin_CentCom lpopl ln_duration dem_pol ln_BattFat ln_GovOSV lag1 leftist fertility Res_Exploit RebelStrength Secc_Con, cluster (RebelID)





**************Using Alternative Control Variables in Table A4**************

nbreg Fatalities frontline_fighters noncombat_outreach Bin_CentCom lpopl ln_duration dem_pol ln_BattFat ln_GovOSV lag1 Islamic labor_force Res_Exploit FightingCapacity Terr_Conflict, cluster (RebelID)





**************Adding Forced Recruitment and Political Wing Variables in Table A5**************


**************Using Forced Recruitment in Model 1**************

nbreg Fatalities frontline_fighters noncombat_outreach FR_year Bin_CentCom lpopl ln_duration dem_pol ln_BattFat ln_GovOSV lag1 leftist fertility Res_Exploit RebelStrength Secc_Con, cluster (RebelID)


**************Using Political Wing in Model 2**************

nbreg Fatalities frontline_fighters noncombat_outreach Pol_Wing Bin_CentCom lpopl ln_duration dem_pol ln_BattFat ln_GovOSV lag1 leftist fertility Res_Exploit RebelStrength Secc_Con, cluster (RebelID)


**************Limiting analysis to groups with a Political Wing in Model 3**************
nbreg Fatalities frontline_fighters noncombat_outreach Bin_CentCom lpopl ln_duration dem_pol ln_BattFat ln_GovOSV lag1 leftist fertility Res_Exploit RebelStrength Secc_Con if Pol_Wing==1, cluster (RebelID)





**************Interactive Effect of Frontline Fighters and Noncombat Outreach in Table A6**************

*gen full_front_outreach=frontline_fighters*noncombat_outreach*   *(Command used to create interaction variable)*


nbreg Fatalities frontline_fighters noncombat_outreach frontline_outreach Bin_CentCom lpopl ln_duration dem_pol ln_BattFat ln_GovOSV lag1 leftist fertility Res_Exploit RebelStrength Secc_Con, cluster (RebelID)





**************Dyadic Level Analysis in Table A7**************

********Generating Dyadic Variables********
egen Dyad_Fatalities= sum(Fatalities), by (dyadid)

egen Dyad_Gov_OSV= sum(GovOSV), by (dyadid)

sum duration

egen Dyad_duration= max(duration), by (dyadid)

sum BattleFatalities

egen Dyad_BD= sum(BattleFatalities), by(dyadid)

sum fertility

egen avg_fertility= mean(fertility), by(ccode)

egen mode_dem= mode(dem_pol), by(ccode)

sum lpopl

egen avg_pop= mean(lpopl), by(ccode)

egen mode_exploit=mode(Res_Exploit), by(RebelID)

sum RebelStrength

egen avg_RebStrgth= mean(RebelStrength), by(dyadid)

egen mode_Command= mode(Bin_CentCom), by(dyadid)

egen mode_seccession= mode(Secc_Con), by(dyadid)


collapse Dyad_Fatalities frontline_fighters noncombat_outreach frontline_prev_best Dyad_Gov_OSV Dyad_duration Dyad_BD leftist avg_fertility avg_pop mode_dem mode_exploit avg_RebStrgth mode_Command mode_seccession, by(dyadid)

 
************Estimating Dyadic Model**************

nbreg Dyad_Fatalities frontline_fighters noncombat_outreach mode_Command avg_pop Dyad_duration mode_dem Dyad_BD Dyad_Gov_OSV leftist avg_fertility mode_exploit avg_RebStrgth mode_seccession

